/*
 *接口编写处...
*如果接口需要做Action的权限验证，请在Action上使用属性
*如: [ApiActionPermission("daojiaogd_gz",Enums.ActionPermissionOptions.Search)]
 */
using Microsoft.AspNetCore.Mvc;
using System;
using System.Collections.Generic;
using System.Threading.Tasks;
using Microsoft.Extensions.DependencyInjection;
using Microsoft.AspNetCore.Http;
using ATkg.BizAppProject.DomainModels;
using ATkg.BizAppProject.IServices;
using Microsoft.AspNetCore.Authorization;
using Newtonsoft.Json.Linq;

namespace ATkg.BizAppProject.Controllers
{
    public partial class daojiaogd_gzController
    {
        private readonly Idaojiaogd_gzService _service;//访问业务代码
        private readonly IHttpContextAccessor _httpContextAccessor;

        [ActivatorUtilitiesConstructor]
        public daojiaogd_gzController(
            Idaojiaogd_gzService service,
            IHttpContextAccessor httpContextAccessor
        )
        : base(service)
        {
            _service = service;
            _httpContextAccessor = httpContextAccessor;
        }


        [HttpGet("insert_db_gz")]
        [AllowAnonymous]
        //[HttpBody]
        public async Task<JsonResult> insert_db_gz(string mes_data)
        //public async Task<JsonResult> SyncProductionTask_wgjy([FromBody] PageDataOptions order_no_)

        {
            Console.WriteLine("get方法调用");
            //Console.WriteLine(mes_data.GetType);
            //Console.WriteLine(mes_data[0]);
            JArray mes_data_final = JArray.Parse(mes_data);
            Console.WriteLine(mes_data_final[0]);
            
            //Console.WriteLine(mes_data_final["schedule_id"]);
            //Console.WriteLine(mes_data_final["name"]);
            //Console.WriteLine(mes_data_final["little_lot"]);
            //Console.WriteLine(mes_data_final["little_lot"]);
            var r = await Service.insert_db_lot(mes_data_final);
            //var r = 0;

            //var r = 0;
            return JsonNormal(r);
        }

        [HttpGet("search_db_gz")]
        [AllowAnonymous]
        //[HttpBody]
        public async Task<JsonResult> search_db_gz(string mes_data)
        //public async Task<JsonResult> SyncProductionTask_wgjy([FromBody] PageDataOptions order_no_)

        {
            Console.WriteLine("get方法调用");
            //JArray mes_data_final = JArray.Parse(mes_data);
            //Console.WriteLine(mes_data_final[0]);
            var r = await Service.search_db_lot(mes_data);
            //var r = 0;

            //var r = 0;
            return JsonNormal(r);
        }

    }
}
